package paquetedatos;
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
  //import oracle.jdbc.driver.OracleDriver;
    public class TDatos_sql
    {
            protected Connection cn;//objeto conexion
            protected Statement st;//objeto de tipo comando, para ejecutar comandos a la base de datos
            //public ResultSet rs;//equivalente al DataTable de .Net
            Connection con = null;
            //************************************************************************
            public TDatos_sql()throws SQLException	{//constructor de la clase
                  String url="";          
               try {
                     Class.forName("oracle.jdbc.driver.OracleDriver");
                     this.cn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","upds2014");
                   }
                       catch(Exception E)                   {
                           System.out.println(E.getMessage());
                       }
                   }
                                                                                                   
            public ResultSet seleccionar(String strsql)throws SQLException{        
               this.st= this.cn.createStatement();
               return  st.executeQuery(strsql);

            }
            //************************************************************************
            public boolean ejecutar(String strsql)throws SQLException
            {//permite insertar,modificar y elminar registros de la base de datos
            this.st= this.cn.createStatement();  //crea mi statement 
            return(this.st.executeUpdate(strsql)>0);             
        }
         
	//************************************************************************
}

